MyDataUnloadingProc
Your data-unloading function should have the following form:
pascal OSErr MyDataUnloadingProc (Ptr data, long bytesAdded, long refcon);
data
- Points to the data buffer. The compressor uses this parameter to indicate where your data-unloading function can find the compressed data. You establish this data buffer when you start the compression operation. For example, the
data
parameter to theFCompressImage
function (described on page 3-75) defines the location of the data buffer for that operation. This pointer contains a 32-bit clean address. Your data-unloading function should make no other assumptions about the value of this address.- The compressor may also use this parameter to indicate that it wants to reset the mark within the compressed data stream. If the
data
parameter is set tonil
, thebytesNeeded
parameter contains the new mark position, relative to the current position of the output data stream. If your data-unloading function does not support this operation, return a nonzero result code.bytesAdded
Specifies the number of bytes to write or the new mark offset. If the compressor wants to write out some compressed data (that is, the value ofdata
is notnil
), then this parameter specifies how many bytes to write. This value never exceeds the size of the original data buffer. Your data-unloading function should write that data at the current mark in the output data stream.- If the compressor has requested to set a new mark position in the output data stream (that is, the value of
data
isnil
), then this parameter specifies the new mark position relative to the current position of the data stream.refcon
- Contains a reference constant value for use by your data-unloading function. Your application specifies the value of this reference constant in the data-unloading function structure you pass to the Image Compression Manager.
RESULT CODES
noErr 0 No error paramErr -50 Invalid parameter specified codecSpoolErr -8966 Error loading or unloading data